// axios基础的封装
import axios from 'axios'
import { ElMessage } from 'element-plus'
const httpInstance = axios.create({
    // baseURL: 'https://mock.apifox.com/m1/3536425-0-default',
    baseURL: 'http://localhost:8080',
    timeout: 5000
})

// 拦截器

// axios请求拦截器
httpInstance.interceptors.request.use(config => {

    return config
}, e => Promise.reject(e))

// axios响应式拦截器
httpInstance.interceptors.response.use(res => res.data, e => {
    // 统一错误提示
    ElMessage({
        type: 'warning',
        message: "服务器未响应"
    })
    return Promise.reject(e)
})


export default httpInstance